set(ZLIB_PUBLIC_HDRS
    ${CMAKE_CURRENT_BINARY_DIR}/zconf.h
    zlib.h
)

idf_component_register(SRCS 
    adler32.c
    compress.c
    crc32.c
    deflate.c
    gzclose.c
    gzlib.c
    gzread.c
    gzwrite.c
    inflate.c
    infback.c
    inftrees.c
    inffast.c
    trees.c
    uncompr.c
    zutil.c
    INCLUDE_DIRS "include")

target_compile_definitions(${COMPONENT_LIB} PUBLIC USE_ZLIB)

# 使用emscripten环境生成的zonf.h放置当前目录编译